home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 4: GNU Archives
/
Linux Cubed Series 4 - GNU Archives.iso
/
gnu
/
gawk-3.000
/
gawk-3
/
gawk-3.0.0
/
awklib
/
eg
/
prog
/
wordfreq.awk
< prev
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1996-01-11
|
316 b
|
14 lines
# Print list of word frequencies
{
$0 = tolower($0) # remove case distinctions
gsub(/[^a-z0-9_ \t]/, "", $0) # remove punctuation
for (i = 1; i <= NF; i++)
freq[$i]++
}
END {
sort = "sort +1 -nr"
for (word in freq)
printf "%s\t%d\n", word, freq[word] | sort
close(sort)
}